<%-- 
    Document   : home
    Created on : 30 Jun, 2013, 9:55:23 AM
    Author     : Yash
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@page import="beans.item"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Home Page</title>
    </head>
    <body style="background-color: seashell">
        <h1>Welcome to Ecart! </h1>


        <table style="width: auto;border-radius: 15% 15% 15% 15%;background-color: sandybrown">
            <tr>
                <td>
                    <%--
                    <input type="hidden" name="id" value="selected item is:<%=i.getIname()%>">
                    </br>
                    <input type="hidden" name="id" value="item price:<%=i.getIprice()%>">
                    </br>
                    <input type="hidden" name="id" value="detail:<%=i.getIsdesc()%>">
                    </br>
                    <input type="hidden" name="id" value="extra info:<%=i.getIprice()%>">
                    --%>

                    <h2> Get best Laptop, Mobile phones and Tablets as per your requirements </h2>
                    &nbsp;&nbsp;&nbsp; Want to purchase a laptop?<%-- <a href="laptop.jsp">here</a>  --%>
                    <br/>
                <td>
        </table>
        <br>
        <br>
        <div>

            <c:forEach items ="${sessionScope.product}" var="item"> 
                <table style="background-color: floralwhite" >
                    <form action="productAction.do" method="post">
                        <input type="hidden" name="iid" value="${item.id}">
                        <c:out value="product is  :${item.iname}"></c:out>
                            </br>
                        <c:out value="price  :${item.iprice}"></c:out>
                            </br>
                        <c:out value="configuration  :${item.isdesc}"></c:out>
                            </br>
                        <%--  <a href="<c:out value="for more detail ${item.iurl}"></c:out>">Click Here</a> --%>
                        <tr>
                            <td>
                                <input type="submit" value="get detail" style="font-family: fantasy;color: brown;background-color: antiquewhite">
                            </td>
                        </tr>
                    </form>
                </table>
            </c:forEach>
        </div>

    <td>
        <a href="   checkout.jsp">check out</a>
    </td>
    <%--
    ArrayList<item> ai=(ArrayList<item>) session.getAttribute("product");
    ArrayList<item> ai = (ArrayList<item>) application.getAttribute("product");

            out.println(application.getAttributeNames());
            out.println(application.getMajorVersion());
            out.println(application.getMinorVersion());

              or
   
            ArrayList<item> ai =new ArrayList<item>(); 
           (ArrayList<item>) session.getAttribute("product");

            for (item i : ai) {
                 out.print("product: " + i.getIname() + "</br>");
                 out.print("price: " + i.getIprice() + "</br>");
                 out.print("desc: " + i.getIsdesc() + "</br>");
                 out.print("for more detail <a href=\"" + i.getIurl() + "\">Click here</a>");
            }
    --%>

</body>
</html>
